Launch environments

  • Launch environment supporting EventKit events. Expects bundle and file name for every file containing data of events to be added into calendar at test launch. Structure is defined in example project’s file events.json.

    Example:

    let recurringEvents: EventLaunchEnvironment = [ LaunchEnvironmentResourceValue(fileName: "monthly_events", bundleName: "Data") ]
    let nearEvents = EventLaunchEnvironment(resources: (fileName: "todays_events", bundleName: "Test data"), (fileName: "this_week_events", bundleName: nil))
    let nearEvents = EventLaunchEnvironment(shouldCleanBefore: true, resources: (fileName: "todays_events", bundleName: "Test data"), (fileName: "this_week_events", bundleName: nil))
    

    Warning

    Setting shouldCleanBefore to true will remove all events from a device.
    See more

    Declaration

    Swift

    public struct EventLaunchEnvironment : CleanableLaunchEnvironmentWithMultipleValues, AutoMateLaunchEnvironment
  • Launch environment supporting EventKit reminders. Expects bundle and file name for every file containing data of reminders to be added into calendar at test launch. Structure is defined in example project’s file reminders.json.

    Example:

    let recurringReminders: ReminderLaunchEnvironment = [ LaunchEnvironmentResourceValue(fileName: "johnys_birthday_reminder", bundleName: "Data") ]
    let highPriorityReminders = ReminderLaunchEnvironment(resources: (fileName: "automate_release_reminders", bundleName: "Test data"), (fileName: "wwdc_reminders", bundleName: nil))
    let highPriorityReminders = ReminderLaunchEnvironment(shouldCleanBefore: true, resources: (fileName: "automate_release_reminders", bundleName: "Test data"), (fileName: "wwdc_reminders", bundleName: nil))
    

    Warning

    Setting shouldCleanBefore to true will remove all reminders from a device.
    See more

    Declaration

    Swift

    public struct ReminderLaunchEnvironment : CleanableLaunchEnvironmentWithMultipleValues, AutoMateLaunchEnvironment
  • Launch environment supporting Contacts. Expects bundle and file name for every file containing data of contacts to be added to address book at test launch. Structure is defined in example project’s file contacts.json.

    Example:

    let johnContacts: ContactLaunchEnvironment = [ LaunchEnvironmentResourceValue(fileName: "john", bundleName: "Data") ]
    let severalContacts = ContactLaunchEnvironment(resources: (fileName: "michael", bundleName: "Test data"), (fileName: "emma", bundleName: nil))
    let severalContacts = ContactLaunchEnvironment(shouldCleanBefore: true, resources: (fileName: "michael", bundleName: "Test data"), (fileName: "emma", bundleName: nil))
    

    Warning

    Setting shouldCleanBefore to true will remove all contacts from a device.
    See more

    Declaration

    Swift

    public struct ContactLaunchEnvironment : CleanableLaunchEnvironmentWithMultipleValues, AutoMateLaunchEnvironment
  • Most basic and generic structure to pass (key: value) pairs through TestLauncher.

    Example:

    let launchEnvironmentDictionary: LaunchEnvironments = ["CORPORATION_KEY": "PGS", "PROJECT_KEY": "AutoMate"]
    
    See more

    Declaration

    Swift

    public struct LaunchEnvironments : LaunchEnvironmentProtocol, ExpressibleByDictionaryLiteral
  • Protocol defining minimal requirements of launch environment option to be handled by framework.

    Example:

    public struct SimpleLaunchEnvironment: LaunchEnvironmentProtocol {
    
        public typealias Value = String
        public let value: String
        public var launchEnvironments: [String : String]? {
            return [uniqueIdentifier: value]
        }
        public init(value: String) {
            self.value = value
        }
    }
    

    Note

    internal initializer would be generated automatically but it would not fulfill requirement of public protocol.
    See more

    Declaration

    Swift

    public protocol LaunchEnvironmentProtocol : LaunchOption
  • Protocol defining minimal requirements for launch environment option with single values. Provides default implementation for handling singe launch environment by providing key and value.

    Example:

    public struct SimpleLaunchEnvironment: LaunchEnvironmentWithSingleValue {
    
        public typealias Value = String
        public let key = "LAUNCH_KEY"
        public var value: String
    }
    
    let simple = SimpleLaunchEnvironment(value: "LaunchValue")
    
    See more

    Declaration

    Swift

    public protocol LaunchEnvironmentWithSingleValue : LaunchEnvironmentProtocol
  • Protocol defining minimal requirements for launch environment option with multiple values. Provides default implementation for ExpressibleByArrayLiteral protocol.

    Example:

    public struct ArrayLaunchEnvironment: LaunchEnvironmentWithMultipleValues {
    
        public typealias Value = String
        public let valuesCollection: [String]
    
        public init(valuesCollection: [Value]) {
            self.valuesCollection = valuesCollection
        }
    }
    
    let array = ArrayLaunchEnvironment(valuesCollection: ["Value1", "Value2"])
    let array = ["Value1", "Value2"] as ArrayLaunchEnvironment
    

    Note

    internal initializer would be generated automatically but it would not fulfill requirement of public protocol.
    See more

    Declaration

    Swift

    public protocol LaunchEnvironmentWithMultipleValues : LaunchEnvironmentProtocol, ExpressibleByArrayLiteral
  • Protocol to be adapted by all LaunchEnvironment options that give ability to clean present data before saving new. To work as expected it requires handing special flag appended at the beginning of launchEnvironment value. It is implemented by predefined in AutoMate options and assures that default handling is provided by AutoMate - AppBuddy

    Example:

    public struct CleanableSimpleLaunchEnvironment: CleanableLaunchEnvironment, LaunchEnvironmentWithSingleValue {
    
        public typealias Value = String
        public let key = "LAUNCH_KEY"
        public var value: String
        var shouldCleanBefore: Bool
    }
    
    See more

    Declaration

    Swift

    public protocol CleanableLaunchEnvironment : LaunchEnvironmentProtocol
  • Contains basic requirements for type that will be used as value for launch environment.

    Example:

    public enum DataSource: String, LaunchEnvironmentValue {
        case valid = "mock_valid"
        case error = "mock_error"
    }
    
    See more

    Declaration

    Swift

    public protocol LaunchEnvironmentValue
  • Launch environment resource model containing informations required to point proper file containing resource data. Expects bundle and file name. If bundle name is nil main bundle will be searched.

    Example:

    let resource = LaunchEnvironmentResourceValue(fileName: "monthly_events", bundleName: "Data")
    
    See more

    Declaration

    Swift

    public struct LaunchEnvironmentResourceValue : LaunchEnvironmentValue